//! Copyright 2012 Xicut Technology, Inc.
//! All rights reserved
//!
#ifndef __UsartDriver_h__
#define __UsartDriver_h__

#include "BasicTypes.h"

#if defined (__FW_BUILD__)
extern "C" {
    extern void SIM900_USART_IRQHandler(void);
}
#endif

#define TX_BUFF_LEN         200
#define RX_BUFF_LEN         200
#define RX_FIFO_BUFF_LEN    16

class cUsartDriver
{
private:
#if !defined (__FW_BUILD__)
    static          U8  s_pTxBuffer[];
    static volatile U32 s_TxSendingFlag;
    static volatile U32 s_TxLen;
    static volatile U32 s_TxCount;

    static          U8  s_pRxFIFOBuff[];
    static volatile U32 s_RxCount;
    static volatile U32 s_RxHead;
    static volatile U32 s_RxTail;
#endif
    static U8   s_pRxBuff[];
    static U16  s_RxBuffCount;
    static U8   s_pRxTempBuff[];
    static U16  s_RxTempBuffCount;

public:
    static void Init_Reset(U16 baudrate);
    static U8*  GetIncomeMsg(U16 &iLen);
    static bool SendMsg(U8 *pOutData, U16 count);
    static void RunOne();
};

#endif // __UsartDriver_h__
